package com.example.tttttttt.controller;

import com.example.tttttttt.po.User;
import com.example.tttttttt.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName
 * @Description
 * @Author
 * @Date 2022/05/20
 * @Version
 */
@RestController
public class UserController {
    @Autowired
    @Qualifier("myuser")
    private UserService userService;

    @RequestMapping(value = "/users",method = RequestMethod.GET)
    public List<User> getAll(){
        List<User> list = userService.getAll();
        System.out.println("11");
        return list;
    }
    @RequestMapping(value = "/deleU",method = RequestMethod.DELETE)
    public int deleteUser(@RequestParam(value="uid") int uid){
        int i = userService.deleteUser(uid);
        return i;
    }
}
